﻿using System;
using Reviewer.Utilities.Data.MySql;
using MySql.Data.MySqlClient;

namespace Reviewer.Data
{
    /// <summary>
    /// Column information for Crud repositories
    /// </summary>
    internal class CrudColumnInfo : MySqlColumnInfo
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="CrudColumnInfo"/> class.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <param name="name">The name.</param>
        /// <param name="datatype">The datatype.</param>
        /// <param name="size">The size.</param>
        /// <param name="isPrimaryKey">if set to <c>true</c> [is primary key].</param>
        /// <param name="isAlternateKey">if set to <c>true</c> [is alternate key].</param>
        /// <param name="isUpdatable">if set to <c>true</c> [is updatable].</param>
        /// <param name="autoIncrement">if set to <c>true</c> [auto increment].</param>
        public CrudColumnInfo(int index, string name, MySqlDbType datatype, int size, bool isPrimaryKey, bool isAlternateKey, bool isUpdatable, bool autoIncrement) :
            base(index, name, datatype, size)
        {
            this.IsPrimaryKey = isPrimaryKey;
            this.IsAlternateKey = isAlternateKey;
            this.IsUpdatable = isUpdatable;
            this.AutoIncrement = autoIncrement;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CrudColumnInfo"/> class.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <param name="name">The name.</param>
        /// <param name="datatype">The datatype.</param>
        /// <param name="isPrimaryKey">if set to <c>true</c> [is primary key].</param>
        /// <param name="isAlternateKey">if set to <c>true</c> [is alternate key].</param>
        /// <param name="isUpdatable">if set to <c>true</c> [is updatable].</param>
        /// <param name="autoIncrement">if set to <c>true</c> [auto increment].</param>
        public CrudColumnInfo(int index, string name, MySqlDbType datatype, bool isPrimaryKey, bool isAlternateKey, bool isUpdatable, bool autoIncrement) :
            base(index, name, datatype)
        {
            this.IsPrimaryKey = isPrimaryKey;
            this.IsAlternateKey = isAlternateKey;
            this.IsUpdatable = isUpdatable;
            this.AutoIncrement = autoIncrement;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="CrudColumnInfo"/> class.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <param name="name">The name.</param>
        /// <param name="datatype">The datatype.</param>
        /// <param name="isPrimaryKey">if set to <c>true</c> [is primary key].</param>
        /// <param name="isAlternateKey">if set to <c>true</c> [is alternate key].</param>
        /// <param name="isUpdatable">if set to <c>true</c> [is updatable].</param>
        public CrudColumnInfo(int index, string name, MySqlDbType datatype, bool isPrimaryKey, bool isAlternateKey, bool isUpdatable) :
            base(index, name, datatype)
        {
            this.IsPrimaryKey = isPrimaryKey;
            this.IsAlternateKey = isAlternateKey;
            this.IsUpdatable = isUpdatable;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="CrudColumnInfo"/> class.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <param name="name">The name.</param>
        /// <param name="datatype">The datatype.</param>
        /// <param name="size">The size.</param>
        /// <param name="isPrimaryKey">if set to <c>true</c> [is primary key].</param>
        /// <param name="isAlternateKey">if set to <c>true</c> [is alternate key].</param>
        /// <param name="isUpdatable">if set to <c>true</c> [is updatable].</param>
        public CrudColumnInfo(int index, string name, MySqlDbType datatype, int size, bool isPrimaryKey, bool isAlternateKey, bool isUpdatable) :
            base(index, name, datatype, size)
        {
            this.IsPrimaryKey = isPrimaryKey;
            this.IsAlternateKey = isAlternateKey;
            this.IsUpdatable = isUpdatable;
        }

        /// <summary>
        /// Gets or sets a value indicating whether this instance is primary key.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance is primary key; otherwise, <c>false</c>.
        /// </value>
        public bool IsPrimaryKey { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether this instance is alternate key.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance is alternate key; otherwise, <c>false</c>.
        /// </value>
        public bool IsAlternateKey { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether this instance is updatable.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance is updatable; otherwise, <c>false</c>.
        /// </value>
        public bool IsUpdatable { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether [auto increment].
        /// </summary>
        /// <value><c>true</c> if [auto increment]; otherwise, <c>false</c>.</value>
        public bool AutoIncrement { get; set; }
    }
}
